/**
 * tony
 * Apr 14, 2013
 */
package ttt.main;

import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Cursor;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;

import org.eclipse.wb.swing.FocusTraversalOnArray;

/**
 * 
 */
public class About extends JFrame {

	private static final long serialVersionUID = 6336069680364054886L;
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					About frame = new About();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public About() {
		setUndecorated(true);
		setOpacity(0.9f);
		setType(Type.UTILITY);
		setTitle("About");
		setResizable(false);
		setAlwaysOnTop(true);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 372, 265);
		contentPane = new JPanel();
		contentPane.setFocusable(false);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblAppName = new JLabel("TM TicTacToe");
		lblAppName.setFocusable(false);
		lblAppName.setFont(new Font("Tahoma", Font.BOLD, 34));
		lblAppName.setBounds(107, 11, 231, 54);
		contentPane.add(lblAppName);
		
		JLabel lblVersion = new JLabel("Version 1.0.2560.1");
		lblVersion.setFocusable(false);
		lblVersion.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblVersion.setBounds(158, 58, 144, 14);
		contentPane.add(lblVersion);
		
		JTextArea txtDescription = new JTextArea();
		txtDescription.setFocusable(false);
		txtDescription.setFocusTraversalKeysEnabled(false);
		txtDescription.setOpaque(false);
		txtDescription.setFont(new Font("Monospaced", Font.PLAIN, 12));
		txtDescription.setEditable(false);
		txtDescription.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		txtDescription.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
		txtDescription.setBorder(null);
		txtDescription.setText("Created by Tony Misner using Eclipse v4.2.1\r\n\r\nThis application can be freely distributed\r\nNo modifications are allowed unless authorized.\r\n2013 All Rights Reserved");
		txtDescription.setBounds(34, 112, 322, 96);
		contentPane.add(txtDescription);
		
		JButton btnClose = new JButton("Close");
		btnClose.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
			}
		});
		btnClose.setBounds(135, 209, 89, 23);
		contentPane.add(btnClose);
		
		
		//TODO:
//		BufferedImage myPicture;
//		try {
//			myPicture = ImageIO.read(new File("icon.png"));
//			JLabel panelImage = new JLabel(new ImageIcon(myPicture));
//			panelImage.setBounds(10, 23, 89, 71);
//			contentPane.add(panelImage);
//		} catch (IOException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		}
		
		
//		JPanel panelImage = new JPanel();
//		panelImage.setBounds(10, 23, 89, 71);
//		contentPane.add(panelImage);
		setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{btnClose, contentPane, lblAppName, lblVersion, txtDescription}));
	}
}
